package edu.ccut.saturn.studio.logic.model.drop.saturndata;

import java.io.IOException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

public class SaturnDataPropertyLoader {
	public static final String INSERT_PROPERTY = "saturnDataInsert.properties";
	public static final String UPDATA_PROPERTY = "saturnupdata.properties";
	public static final String SATURNQUERY_PROPERTIES = "saturnQuery.properties";
	public static final String SATURNDATADEL_PROPERTIES = "saturnDataDel.properties";
	public static final String SATURNCREAT_PROPERTIES = "saturnCreat.properties";
	public static final String SATURN_SQL_QUERY_PROPERTIES = "saturnsqlQuery.properties";
	private SaturnDataPropertyLoader() {
	}

	public static Map<String, String> getSaturnDataPropertyMap(String fileName) {
		Map<String, String> propertyMap = new HashMap<String, String>();

		Properties properties = new Properties();

		try {
			properties.load(SaturnDataPropertyLoader.class
					.getResourceAsStream(fileName));
		} catch (IOException e) {
			e.printStackTrace();
		}

		Enumeration enumeration = properties.propertyNames();
		while (enumeration.hasMoreElements()) {
			String name = (String) enumeration.nextElement();
			propertyMap.put(name, properties.getProperty(name));
		}
		return propertyMap;
	}

}
